home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / annotate.bst (.txt) < prev    next >
LaTeX Document  |  1992-07-19  |  22KB  |  1,021 lines

  1. % BibTeX bibliography style `annotate'
  2. % based on alpha.
  3. ENTRY
  4.   { address
  5.     annotate
  6.     author
  7.     booktitle
  8.     chapter
  9.     edition
  10.     editor
  11.     howpublished
  12.     institution
  13.     journal
  14.     key
  15.     month
  16.     note
  17.     number
  18.     organization
  19.     pages
  20.     publisher
  21.     school
  22.     series
  23.     title
  24.     type
  25.     volume
  26.     year
  27.   { label extra.label sort.label }
  28. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  29. FUNCTION {init.state.consts}
  30. { #0 'before.all :=
  31.   #1 'mid.sentence :=
  32.   #2 'after.sentence :=
  33.   #3 'after.block :=
  34. STRINGS { s t }
  35. FUNCTION {output.nonnull}
  36. { 's :=
  37.   output.state mid.sentence =
  38.     { ", " * write$ }
  39.     { output.state after.block =
  40.     { add.period$ write$
  41.       newline$
  42.       "\newblock " write$
  43.     { output.state before.all =
  44.         'write$
  45.         { add.period$ " " * write$ }
  46.       if$
  47.       if$
  48.       mid.sentence 'output.state :=
  49.     }
  50.   if$
  51. FUNCTION {output}
  52. { duplicate$ empty$
  53.     'pop$
  54.     'output.nonnull
  55.   if$
  56. FUNCTION {output.check}
  57. { 't :=
  58.   duplicate$ empty$
  59.     { pop$ "empty " t * " in " * cite$ * warning$ }
  60.     'output.nonnull
  61.   if$
  62. FUNCTION {output.bibitem}
  63. { newline$
  64.   "\bibitem[" write$
  65.   label write$
  66.   "]{" write$
  67.   cite$ write$
  68.   "}" write$
  69.   newline$
  70.   before.all 'output.state :=
  71. FUNCTION {fin.entry}
  72. { add.period$
  73.   write$
  74.   newline$
  75. FUNCTION {new.block}
  76. { output.state before.all =
  77.     'skip$
  78.     { after.block 'output.state := }
  79.   if$
  80. FUNCTION {new.sentence}
  81. { output.state after.block =
  82.     'skip$
  83.     { output.state before.all =
  84.     'skip$
  85.     { after.sentence 'output.state := }
  86.       if$
  87.     }
  88.   if$
  89. FUNCTION {not}
  90. {   { #0 }
  91.     { #1 }
  92.   if$
  93. FUNCTION {and}
  94. {   'skip$
  95.     { pop$ #0 }
  96.   if$
  97. FUNCTION {or}
  98. {   { pop$ #1 }
  99.     'skip$
  100.   if$
  101. FUNCTION {new.block.checka}
  102. { empty$
  103.     'skip$
  104.     'new.block
  105.   if$
  106. FUNCTION {new.block.checkb}
  107. { empty$
  108.   swap$ empty$
  109.   and
  110.     'skip$
  111.     'new.block
  112.   if$
  113. FUNCTION {new.sentence.checka}
  114. { empty$
  115.     'skip$
  116.     'new.sentence
  117.   if$
  118. FUNCTION {new.sentence.checkb}
  119. { empty$
  120.   swap$ empty$
  121.   and
  122.     'skip$
  123.     'new.sentence
  124.   if$
  125. FUNCTION {field.or.null}
  126. { duplicate$ empty$
  127.     { pop$ "" }
  128.     'skip$
  129.   if$
  130. FUNCTION {emphasize}
  131. { duplicate$ empty$
  132.     { pop$ "" }
  133.     { "{\em " swap$ * "}" * }
  134.   if$
  135. INTEGERS { nameptr namesleft numnames }
  136. FUNCTION {format.names}
  137. { 's :=
  138.   #1 'nameptr :=
  139.   s num.names$ 'numnames :=
  140.   numnames 'namesleft :=
  141.     { namesleft #0 > }
  142.     { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
  143.       nameptr #1 >
  144.     { namesleft #1 >
  145.         { ", " * t * }
  146.         { numnames #2 >
  147.         { "," * }
  148.         'skip$
  149.           if$
  150.           t "others" =
  151.         { " et~al." * }
  152.         { " and " * t * }
  153.           if$
  154.         }
  155.       if$
  156.       if$
  157.       nameptr #1 + 'nameptr :=
  158.       namesleft #1 - 'namesleft :=
  159.     }
  160.   while$
  161. FUNCTION {format.authors}
  162. { author empty$
  163.     { "" }
  164.     { author format.names }
  165.   if$
  166. FUNCTION {format.annotate}
  167. { annotate empty$
  168.     { "" }
  169.     { " \begin{quotation}\noindent "
  170.       annotate
  171.       * " \end{quotation} " *
  172.       if$
  173. FUNCTION {format.editors}
  174. { editor empty$
  175.     { "" }
  176.     { editor format.names
  177.       editor num.names$ #1 >
  178.     { ", editors" * }
  179.     { ", editor" * }
  180.       if$
  181.     }
  182.   if$
  183. FUNCTION {format.title}
  184. { title empty$
  185.     { "" }
  186.     { title "t" change.case$ }
  187.   if$
  188. FUNCTION {n.dashify}
  189. { 't :=
  190.     { t empty$ not }
  191.     { t #1 #1 substring$ "-" =
  192.     { t #1 #2 substring$ "--" = not
  193.         { "--" *
  194.           t #2 global.max$ substring$ 't :=
  195.         }
  196.         {   { t #1 #1 substring$ "-" = }
  197.         { "-" *
  198.           t #2 global.max$ substring$ 't :=
  199.           while$
  200.         }
  201.       if$
  202.     { t #1 #1 substring$ *
  203.       t #2 global.max$ substring$ 't :=
  204.       if$
  205.     }
  206.   while$
  207. FUNCTION {format.date}
  208. { year empty$
  209.     { month empty$
  210.     { "" }
  211.     { "there's a month but no year in " cite$ * warning$
  212.       month
  213.       if$
  214.     }
  215.     { month empty$
  216.     'year
  217.     { month " " * year * }
  218.       if$
  219.     }
  220.   if$
  221. FUNCTION {format.btitle}
  222. { title emphasize
  223. FUNCTION {tie.or.space.connect}
  224. { duplicate$ text.length$ #3 <
  225.     { "~" }
  226.     { " " }
  227.   if$
  228.   swap$ * *
  229. FUNCTION {either.or.check}
  230. { empty$
  231.     'pop$
  232.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  233.   if$
  234. FUNCTION {format.bvolume}
  235. { volume empty$
  236.     { "" }
  237.     { "volume" volume tie.or.space.connect
  238.       series empty$
  239.     'skip$
  240.     { " of " * series emphasize * }
  241.       if$
  242.       "volume and number" number either.or.check
  243.     }
  244.   if$
  245. FUNCTION {format.number.series}
  246. { volume empty$
  247.     { number empty$
  248.     { series field.or.null }
  249.     { output.state mid.sentence =
  250.         { "number" }
  251.         { "Number" }
  252.       if$
  253.       number tie.or.space.connect
  254.       series empty$
  255.         { "there's a number but no series in " cite$ * warning$ }
  256.         { " in " * series * }
  257.       if$
  258.       if$
  259.     }
  260.     { "" }
  261.   if$
  262. FUNCTION {format.edition}
  263. { edition empty$
  264.     { "" }
  265.     { output.state mid.sentence =
  266.     { edition "l" change.case$ " edition" * }
  267.     { edition "t" change.case$ " edition" * }
  268.       if$
  269.     }
  270.   if$
  271. INTEGERS { multiresult }
  272. FUNCTION {multi.page.check}
  273. { 't :=
  274.   #0 'multiresult :=
  275.     { multiresult not
  276.       t empty$ not
  277.       and
  278.     }
  279.     { t #1 #1 substring$
  280.       duplicate$ "-" =
  281.       swap$ duplicate$ "," =
  282.       swap$ "+" =
  283.       or or
  284.     { #1 'multiresult := }
  285.     { t #2 global.max$ substring$ 't := }
  286.       if$
  287.     }
  288.   while$
  289.   multiresult
  290. FUNCTION {format.pages}
  291. { pages empty$
  292.     { "" }
  293.     { pages multi.page.check
  294.     { "pages" pages n.dashify tie.or.space.connect }
  295.     { "page" pages tie.or.space.connect }
  296.       if$
  297.     }
  298.   if$
  299. FUNCTION {format.vol.num.pages}
  300. { volume field.or.null
  301.   number empty$
  302.     'skip$
  303.     { "(" number * ")" * *
  304.       volume empty$
  305.     { "there's a number but no volume in " cite$ * warning$ }
  306.     'skip$
  307.       if$
  308.     }
  309.   if$
  310.   pages empty$
  311.     'skip$
  312.     { duplicate$ empty$
  313.     { pop$ format.pages }
  314.     { ":" * pages n.dashify * }
  315.       if$
  316.     }
  317.   if$
  318. FUNCTION {format.chapter.pages}
  319. { chapter empty$
  320.     'format.pages
  321.     { type empty$
  322.     { "chapter" }
  323.     { type "l" change.case$ }
  324.       if$
  325.       chapter tie.or.space.connect
  326.       pages empty$
  327.     'skip$
  328.     { ", " * format.pages * }
  329.       if$
  330.     }
  331.   if$
  332. FUNCTION {format.in.ed.booktitle}
  333. { booktitle empty$
  334.     { "" }
  335.     { editor empty$
  336.     { "In " booktitle emphasize * }
  337.     { "In " format.editors * ", " * booktitle emphasize * }
  338.       if$
  339.     }
  340.   if$
  341. FUNCTION {empty.misc.check}
  342. { author empty$ title empty$ howpublished empty$
  343.   month empty$ year empty$ note empty$
  344.   and and and and and
  345.   key empty$ not and
  346.     { "all relevant fields are empty in " cite$ * warning$ }
  347.     'skip$
  348.   if$
  349. FUNCTION {format.thesis.type}
  350. { type empty$
  351.     'skip$
  352.     { pop$
  353.       type "t" change.case$
  354.     }
  355.   if$
  356. FUNCTION {format.tr.number}
  357. { type empty$
  358.     { "Technical Report" }
  359.     'type
  360.   if$
  361.   number empty$
  362.     { "t" change.case$ }
  363.     { number tie.or.space.connect }
  364.   if$
  365. FUNCTION {format.article.crossref}
  366. { key empty$
  367.     { journal empty$
  368.     { "need key or journal for " cite$ * " to crossref " * crossref *
  369.       warning$
  370.       ""
  371.     { "In {\em " journal * "\/}" * }
  372.       if$
  373.     }
  374.     { "In " key * }
  375.   if$
  376.   " \cite{" * crossref * "}" *
  377. FUNCTION {format.crossref.editor}
  378. { editor #1 "{vv~}{ll}" format.name$
  379.   editor num.names$ duplicate$
  380.   #2 >
  381.     { pop$ " et~al." * }
  382.     { #2 <
  383.     'skip$
  384.     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  385.         { " et~al." * }
  386.         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  387.       if$
  388.       if$
  389.     }
  390.   if$
  391. FUNCTION {format.book.crossref}
  392. { volume empty$
  393.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  394.       "In "
  395.     }
  396.     { "Volume" volume tie.or.space.connect
  397.       " of " *
  398.     }
  399.   if$
  400.   editor empty$
  401.   editor field.or.null author field.or.null =
  402.     { key empty$
  403.     { series empty$
  404.         { "need editor, key, or series for " cite$ * " to crossref " *
  405.           crossref * warning$
  406.           "" *
  407.         }
  408.         { "{\em " * series * "\/}" * }
  409.       if$
  410.     { key * }
  411.       if$
  412.     }
  413.     { format.crossref.editor * }
  414.   if$
  415.   " \cite{" * crossref * "}" *
  416. FUNCTION {format.incoll.inproc.crossref}
  417. { editor empty$
  418.   editor field.or.null author field.or.null =
  419.     { key empty$
  420.     { booktitle empty$
  421.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  422.           crossref * warning$
  423.           ""
  424.         }
  425.         { "In {\em " booktitle * "\/}" * }
  426.       if$
  427.     { "In " key * }
  428.       if$
  429.     }
  430.     { "In " format.crossref.editor * }
  431.   if$
  432.   " \cite{" * crossref * "}" *
  433. FUNCTION {article}
  434. { output.bibitem
  435.   format.authors "author" output.check
  436.   new.block
  437.   format.title "title" output.check
  438.   new.block
  439.   crossref missing$
  440.     { journal emphasize "journal" output.check
  441.       format.vol.num.pages output
  442.       format.date "year" output.check
  443.     }
  444.     { format.article.crossref output.nonnull
  445.       format.pages output
  446.     }
  447.   if$
  448.   new.block
  449.   note output 
  450.   fin.entry
  451.   format.annotate write$
  452.   newline$
  453. FUNCTION {book}
  454. { output.bibitem
  455.   author empty$
  456.     { format.editors "author and editor" output.check }
  457.     { format.authors output.nonnull
  458.       crossref missing$
  459.     { "author and editor" editor either.or.check }
  460.     'skip$
  461.       if$
  462.     }
  463.   if$
  464.   new.block
  465.   format.btitle "title" output.check
  466.   crossref missing$
  467.     { format.bvolume output
  468.       new.block
  469.       format.number.series output
  470.       new.sentence
  471.       publisher "publisher" output.check
  472.       address output
  473.     }
  474.     { new.block
  475.       format.book.crossref output.nonnull
  476.     }
  477.   if$
  478.   format.edition output
  479.   format.date "year" output.check
  480.   new.block
  481.   note output
  482.   fin.entry
  483.   format.annotate write$
  484.   newline$
  485. FUNCTION {booklet}
  486. { output.bibitem
  487.   format.authors output
  488.   new.block
  489.   format.title "title" output.check
  490.   howpublished address new.block.checkb
  491.   howpublished output
  492.   address output
  493.   format.date output
  494.   new.block
  495.   note output
  496.   fin.entry
  497.   format.annotate write$
  498.   newline$
  499. FUNCTION {inbook}
  500. { output.bibitem
  501.   author empty$
  502.     { format.editors "author and editor" output.check }
  503.     { format.authors output.nonnull
  504.       crossref missing$
  505.     { "author and editor" editor either.or.check }
  506.     'skip$
  507.       if$
  508.     }
  509.   if$
  510.   new.block
  511.   format.btitle "title" output.check
  512.   crossref missing$
  513.     { format.bvolume output
  514.       format.chapter.pages "chapter and pages" output.check
  515.       new.block
  516.       format.number.series output
  517.       new.sentence
  518.       publisher "publisher" output.check
  519.       address output
  520.     }
  521.     { format.chapter.pages "chapter and pages" output.check
  522.       new.block
  523.       format.book.crossref output.nonnull
  524.     }
  525.   if$
  526.   format.edition output
  527.   format.date "year" output.check
  528.   new.block
  529.   note output
  530.   fin.entry
  531.   format.annotate write$
  532. FUNCTION {incollection}
  533. { output.bibitem
  534.   format.authors "author" output.check
  535.   new.block
  536.   format.title "title" output.check
  537.   new.block
  538.   crossref missing$
  539.     { format.in.ed.booktitle "booktitle" output.check
  540.       format.bvolume output
  541.       format.number.series output
  542.       format.chapter.pages output
  543.       new.sentence
  544.       publisher "publisher" output.check
  545.       address output
  546.       format.edition output
  547.       format.date "year" output.check
  548.     }
  549.     { format.incoll.inproc.crossref output.nonnull
  550.       format.chapter.pages output
  551.     }
  552.   if$
  553.   new.block
  554.   note output
  555.   fin.entry
  556.   format.annotate write$
  557. FUNCTION {inproceedings}
  558. { output.bibitem
  559.   format.authors "author" output.check
  560.   new.block
  561.   format.title "title" output.check
  562.   new.block
  563.   crossref missing$
  564.     { format.in.ed.booktitle "booktitle" output.check
  565.       format.bvolume output
  566.       format.number.series output
  567.       format.pages output
  568.       address empty$
  569.     { organization publisher new.sentence.checkb
  570.       organization output
  571.       publisher output
  572.       format.date "year" output.check
  573.     { address output.nonnull
  574.       format.date "year" output.check
  575.       new.sentence
  576.       organization output
  577.       publisher output
  578.       if$
  579.     }
  580.     { format.incoll.inproc.crossref output.nonnull
  581.       format.pages output
  582.     }
  583.   if$
  584.   new.block
  585.   note output
  586.   fin.entry
  587.   format.annotate write$  
  588. FUNCTION {conference} { inproceedings }
  589. FUNCTION {manual}
  590. { output.bibitem
  591.   author empty$
  592.     { organization empty$
  593.     'skip$
  594.     { organization output.nonnull
  595.       address output
  596.       if$
  597.     }
  598.     { format.authors output.nonnull }
  599.   if$
  600.   new.block
  601.   format.btitle "title" output.check
  602.   author empty$
  603.     { organization empty$
  604.     { address new.block.checka
  605.       address output
  606.     'skip$
  607.       if$
  608.     }
  609.     { organization address new.block.checkb
  610.       organization output
  611.       address output
  612.     }
  613.   if$
  614.   format.edition output
  615.   format.date output
  616.   new.block
  617.   note output
  618.   fin.entry
  619.   format.annotate write$
  620. FUNCTION {mastersthesis}
  621. { output.bibitem
  622.   format.authors "author" output.check
  623.   new.block
  624.   format.title "title" output.check
  625.   new.block
  626.   "Master's thesis" format.thesis.type output.nonnull
  627.   school "school" output.check
  628.   address output
  629.   format.date "year" output.check
  630.   new.block
  631.   note output
  632.   fin.entry
  633.   format.annotate write$
  634. FUNCTION {misc}
  635. { output.bibitem
  636.   format.authors output
  637.   title howpublished new.block.checkb
  638.   format.title output
  639.   howpublished new.block.checka
  640.   howpublished output
  641.   format.date output
  642.   new.block
  643.   note output
  644.   fin.entry
  645.   format.annotate write$
  646.   empty.misc.check
  647. FUNCTION {phdthesis}
  648. { output.bibitem
  649.   format.authors "author" output.check
  650.   new.block
  651.   format.btitle "title" output.check
  652.   new.block
  653.   "PhD thesis" format.thesis.type output.nonnull
  654.   school "school" output.check
  655.   address output
  656.   format.date "year" output.check
  657.   new.block
  658.   note output
  659.   fin.entry
  660.   format.annotate write$
  661. FUNCTION {proceedings}
  662. { output.bibitem
  663.   editor empty$
  664.     { organization output }
  665.     { format.editors output.nonnull }
  666.   if$
  667.   new.block
  668.   format.btitle "title" output.check
  669.   format.bvolume output
  670.   format.number.series output
  671.   address empty$
  672.     { editor empty$
  673.     { publisher new.sentence.checka }
  674.     { organization publisher new.sentence.checkb
  675.       organization output
  676.       if$
  677.       publisher output
  678.       format.date "year" output.check
  679.     }
  680.     { address output.nonnull
  681.       format.date "year" output.check
  682.       new.sentence
  683.       editor empty$
  684.     'skip$
  685.     { organization output }
  686.       if$
  687.       publisher output
  688.     }
  689.   if$
  690.   new.block
  691.   note output
  692.   fin.entry
  693.   format.annotate write$
  694. FUNCTION {techreport}
  695. { output.bibitem
  696.   format.authors "author" output.check
  697.   new.block
  698.   format.title "title" output.check
  699.   new.block
  700.   format.tr.number output.nonnull
  701.   institution "institution" output.check
  702.   address output
  703.   format.date "year" output.check
  704.   new.block
  705.   note output
  706.   fin.entry
  707.   format.annotate write$
  708. FUNCTION {unpublished}
  709. { output.bibitem
  710.   format.authors "author" output.check
  711.   new.block
  712.   format.title "title" output.check
  713.   new.block
  714.   note "note" output.check
  715.   format.date output
  716.   fin.entry
  717.   format.annotate write$
  718. FUNCTION {default.type} { misc }
  719. MACRO {jan} {"January"}
  720. MACRO {feb} {"February"}
  721. MACRO {mar} {"March"}
  722. MACRO {apr} {"April"}
  723. MACRO {may} {"May"}
  724. MACRO {jun} {"June"}
  725. MACRO {jul} {"July"}
  726. MACRO {aug} {"August"}
  727. MACRO {sep} {"September"}
  728. MACRO {oct} {"October"}
  729. MACRO {nov} {"November"}
  730. MACRO {dec} {"December"}
  731. MACRO {acmcs} {"ACM Computing Surveys"}
  732. MACRO {acta} {"Acta Informatica"}
  733. MACRO {cacm} {"Communications of the ACM"}
  734. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  735. MACRO {ibmsj} {"IBM Systems Journal"}
  736. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  737. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  738. MACRO {ieeetcad}
  739.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  740. MACRO {ipl} {"Information Processing Letters"}
  741. MACRO {jacm} {"Journal of the ACM"}
  742. MACRO {jcss} {"Journal of Computer and System Sciences"}
  743. MACRO {scp} {"Science of Computer Programming"}
  744. MACRO {sicomp} {"SIAM Journal on Computing"}
  745. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  746. MACRO {tods} {"ACM Transactions on Database Systems"}
  747. MACRO {tog} {"ACM Transactions on Graphics"}
  748. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  749. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  750. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  751. MACRO {tcs} {"Theoretical Computer Science"}
  752. FUNCTION {sortify}
  753. { purify$
  754.   "l" change.case$
  755. INTEGERS { len }
  756. FUNCTION {chop.word}
  757. { 's :=
  758.   'len :=
  759.   s #1 len substring$ =
  760.     { s len #1 + global.max$ substring$ }
  761.     's
  762.   if$
  763. INTEGERS { et.al.char.used }
  764. FUNCTION {initialize.et.al.char.used}
  765. { #0 'et.al.char.used :=
  766. EXECUTE {initialize.et.al.char.used}
  767. FUNCTION {format.lab.names}
  768. { 's :=
  769.   s num.names$ 'numnames :=
  770.   numnames #1 >
  771.     { numnames #4 >
  772.     { #3 'namesleft := }
  773.     { numnames 'namesleft := }
  774.       if$
  775.       #1 'nameptr :=
  776.       ""
  777.     { namesleft #0 > }
  778.     { nameptr numnames =
  779.         { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  780.         { "{\etalchar{+}}" *
  781.           #1 'et.al.char.used :=
  782.         { s nameptr "{v{}}{l{}}" format.name$ * }
  783.           if$
  784.         }
  785.         { s nameptr "{v{}}{l{}}" format.name$ * }
  786.       if$
  787.       nameptr #1 + 'nameptr :=
  788.       namesleft #1 - 'namesleft :=
  789.       while$
  790.       numnames #4 >
  791.     { "{\etalchar{+}}" *
  792.       #1 'et.al.char.used :=
  793.     'skip$
  794.       if$
  795.     }
  796.     { s #1 "{v{}}{l{}}" format.name$
  797.       duplicate$ text.length$ #2 <
  798.     { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
  799.     'skip$
  800.       if$
  801.     }
  802.   if$
  803. FUNCTION {author.key.label}
  804. { author empty$
  805.     { key empty$
  806.     { cite$ #1 #3 substring$ }
  807.     { key #3 text.prefix$ }
  808.       if$
  809.     }
  810.     { author format.lab.names }
  811.   if$
  812. FUNCTION {author.editor.key.label}
  813. { author empty$
  814.     { editor empty$
  815.     { key empty$
  816.         { cite$ #1 #3 substring$ }
  817.         { key #3 text.prefix$ }
  818.       if$
  819.     { editor format.lab.names }
  820.       if$
  821.     }
  822.     { author format.lab.names }
  823.   if$
  824. FUNCTION {author.key.organization.label}
  825. { author empty$
  826.     { key empty$
  827.     { organization empty$
  828.         { cite$ #1 #3 substring$ }
  829.         { "The " #4 organization chop.word #3 text.prefix$ }
  830.       if$
  831.     { key #3 text.prefix$ }
  832.       if$
  833.     }
  834.     { author format.lab.names }
  835.   if$
  836. FUNCTION {editor.key.organization.label}
  837. { editor empty$
  838.     { key empty$
  839.     { organization empty$
  840.         { cite$ #1 #3 substring$ }
  841.         { "The " #4 organization chop.word #3 text.prefix$ }
  842.       if$
  843.     { key #3 text.prefix$ }
  844.       if$
  845.     }
  846.     { editor format.lab.names }
  847.   if$
  848. FUNCTION {calc.label}
  849. { type$ "book" =
  850.   type$ "inbook" =
  851.     'author.editor.key.label
  852.     { type$ "proceedings" =
  853.     'editor.key.organization.label
  854.     { type$ "manual" =
  855.         'author.key.organization.label
  856.         'author.key.label
  857.       if$
  858.       if$
  859.     }
  860.   if$
  861.   duplicate$
  862.   year field.or.null purify$ #-1 #2 substring$
  863.   'label :=
  864.   year field.or.null purify$ #-1 #4 substring$
  865.   sortify 'sort.label :=
  866. FUNCTION {sort.format.names}
  867. { 's :=
  868.   #1 'nameptr :=
  869.   s num.names$ 'numnames :=
  870.   numnames 'namesleft :=
  871.     { namesleft #0 > }
  872.     { nameptr #1 >
  873.     { "   " * }
  874.     'skip$
  875.       if$
  876.       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
  877.       nameptr numnames = t "others" = and
  878.     { "et al" * }
  879.     { t sortify * }
  880.       if$
  881.       nameptr #1 + 'nameptr :=
  882.       namesleft #1 - 'namesleft :=
  883.     }
  884.   while$
  885. FUNCTION {sort.format.title}
  886. { 't :=
  887.   "A " #2
  888.     "An " #3
  889.       "The " #4 t chop.word
  890.     chop.word
  891.   chop.word
  892.   sortify
  893.   #1 global.max$ substring$
  894. FUNCTION {author.sort}
  895. { author empty$
  896.     { key empty$
  897.     { "to sort, need author or key in " cite$ * warning$
  898.       ""
  899.     { key sortify }
  900.       if$
  901.     }
  902.     { author sort.format.names }
  903.   if$
  904. FUNCTION {author.editor.sort}
  905. { author empty$
  906.     { editor empty$
  907.     { key empty$
  908.         { "to sort, need author, editor, or key in " cite$ * warning$
  909.           ""
  910.         }
  911.         { key sortify }
  912.       if$
  913.     { editor sort.format.names }
  914.       if$
  915.     }
  916.     { author sort.format.names }
  917.   if$
  918. FUNCTION {author.organization.sort}
  919. { author empty$
  920.     { organization empty$
  921.     { key empty$
  922.         { "to sort, need author, organization, or key in " cite$ * warning$
  923.           ""
  924.         }
  925.         { key sortify }
  926.       if$
  927.     { "The " #4 organization chop.word sortify }
  928.       if$
  929.     }
  930.     { author sort.format.names }
  931.   if$
  932. FUNCTION {editor.organization.sort}
  933. { editor empty$
  934.     { organization empty$
  935.     { key empty$
  936.         { "to sort, need editor, organization, or key in " cite$ * warning$
  937.           ""
  938.         }
  939.         { key sortify }
  940.       if$
  941.     { "The " #4 organization chop.word sortify }
  942.       if$
  943.     }
  944.     { editor sort.format.names }
  945.   if$
  946. FUNCTION {presort}
  947. { calc.label
  948.   sort.label
  949.   "    "
  950.   type$ "book" =
  951.   type$ "inbook" =
  952.     'author.editor.sort
  953.     { type$ "proceedings" =
  954.     'editor.organization.sort
  955.     { type$ "manual" =
  956.         'author.organization.sort
  957.         'author.sort
  958.       if$
  959.       if$
  960.     }
  961.   if$
  962.   "    "
  963.   year field.or.null sortify
  964.   "    "
  965.   title field.or.null
  966.   sort.format.title
  967.   #1 entry.max$ substring$
  968.   'sort.key$ :=
  969. ITERATE {presort}
  970. STRINGS { longest.label last.sort.label next.extra }
  971. INTEGERS { longest.label.width last.extra.num }
  972. FUNCTION {initialize.longest.label}
  973. { "" 'longest.label :=
  974.   #0 int.to.chr$ 'last.sort.label :=
  975.   "" 'next.extra :=
  976.   #0 'longest.label.width :=
  977.   #0 'last.extra.num :=
  978. FUNCTION {forward.pass}
  979. { last.sort.label sort.label =
  980.     { last.extra.num #1 + 'last.extra.num :=
  981.       last.extra.num int.to.chr$ 'extra.label :=
  982.     }
  983.     { "a" chr.to.int$ 'last.extra.num :=
  984.       "" 'extra.label :=
  985.       sort.label 'last.sort.label :=
  986.     }
  987.   if$
  988. FUNCTION {reverse.pass}
  989. { next.extra "b" =
  990.     { "a" 'extra.label := }
  991.     'skip$
  992.   if$
  993.   label extra.label * 'label :=
  994.   label width$ longest.label.width >
  995.     { label 'longest.label :=
  996.       label width$ 'longest.label.width :=
  997.     }
  998.     'skip$
  999.   if$
  1000.   extra.label 'next.extra :=
  1001. EXECUTE {initialize.longest.label}
  1002. ITERATE {forward.pass}
  1003. REVERSE {reverse.pass}
  1004. FUNCTION {begin.bib}
  1005. { et.al.char.used
  1006.     { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
  1007.     'skip$
  1008.   if$
  1009.   preamble$ empty$
  1010.     'skip$
  1011.     { preamble$ write$ newline$ }
  1012.   if$
  1013.   "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
  1014. EXECUTE {begin.bib}
  1015. EXECUTE {init.state.consts}
  1016. ITERATE {call.type$}
  1017. FUNCTION {end.bib}
  1018. { newline$
  1019.   "\end{thebibliography}" write$ newline$
  1020. EXECUTE {end.bib}
  1021.